import Vue from 'vue'
import VueRouter from 'vue-router'
import layout from '../views/layout/index.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect:"/home/dashboard"
  },
  {
    path: '/login',
    name: 'login',
    component: () => import(/* webpackChunkName: "login" */ '../views/login/index.vue')
  },
  {
    path: '/home',
    name: "home",
    component:layout,
    meta: { title: "首页", icon: "icon-panel", type: "2" },
    children:[
      {path:"dashboard",name:"dashboard", component:()=>import(/* webpackChunkName: "dashboard" */ '../views/dashboard/index.vue'),meta:{title:"仪表盘",type:"2"}},
      {path:"dashboarddata",name:"dashboarddata", component:()=>import(/* webpackChunkName: "dashboarddata" */ '../views/dashboard/dashboarddata.vue'),meta:{title: "设备数据",type: "2"}},
    ]
  },
  {
    path: '/device',
    name: "device",
    component:layout,
    meta:{title: "设备", icon: "icon-luyouqi",type: "2"},
    children:[
      {path:"gateway",name:"gateway", component:()=>import(/* webpackChunkName: "gateway" */ '../views/device/gateway.vue'),meta: {title: "网关",type: "2"}},
      {path:"group",name:"group", component:()=>import(/* webpackChunkName: "group" */ '../views/device/group.vue'),meta: {title: "设备群组",type: "2"}},
      {path:"sensor",name:"sensor", component:()=>import(/* webpackChunkName: "sensor" */ '../views/device/sensor.vue'),meta: {title: "传感器列表",type: "2"}},
    ]
  },
  {
    path: '/account',
    name:"account",
    component:layout,
    meta:{title: "账号",icon: "icon-account",type: "1"},
    children:[
      {path:"add",name:"add", component:()=>import(/* webpackChunkName: "add" */ '../views/account/add.vue'),meta: {title: "添加账号",type: "1"}},
      { path: "list", name: "list", component: () => import(/* webpackChunkName: "list" */ '../views/account/list.vue'), meta: { title: "账号列表", type: "1" } }
    ]
  },
  {
    path: '*',
    name: 'page404',
    component: () => import(/* webpackChunkName: "about" */ '../views/page404/index.vue')
  }
]

const router = new VueRouter({
  routes
})

export default router
